package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易类型(1-商品本金,2-商品补贴,3-佣金)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum OrderSettleBillTradeTypeEnum {

    MERCHANT_AMT(1, "商品本金"),
    SUBSIDY_AMT(2, "商品补贴"),
    COMMISSION_AMT(3, "佣金"),
    RECOVER_AMT(4, "未核销金额回收给商家")
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    OrderSettleBillTradeTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static OrderSettleBillTradeTypeEnum typeOf(Integer value) {
        OrderSettleBillTradeTypeEnum[] values = OrderSettleBillTradeTypeEnum.values();
        for (OrderSettleBillTradeTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static OrderSettleBillTradeTypeEnum typeOf(String name) {
        OrderSettleBillTradeTypeEnum[] values = OrderSettleBillTradeTypeEnum.values();
        for (OrderSettleBillTradeTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
